<%--
  Created by IntelliJ IDEA.
  User: lixin
  Date: 2017/5/12
  Time: 10:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="page" %>
<page:page>
    <style>
        /*蓝色按钮,绝对定位*/
        .blueButton {
            position: absolute;
            display: block;
            width: 70px;
            height: 34px;
            text-decoration: none;
            text-align: center;
            font:normal normal normal 14px/34px 'Microsoft YaHei';
            cursor: pointer;
        }

        /*使读取和调拨按钮与上传按钮格式一致*/
        .blueInput {
            width: 70px;
            height: 34px;
            font-size: 14px;
            font-family: 'Microsoft YaHei';
        }

        .blueButton:hover {
            text-decoration: none;
        }
        /*自定义上传,位置大小都和a完全一样,而且完全透明*/
        .myFileUpload {
            position: absolute;
            display: block;
            width: 70px;
            height: 30px;
            opacity: 0;
            top:15px;
        }
        /*显示上传文件夹名的Div*/
        .show {
            /*position: absolute;*/
            top:37px;
            /*width: 100%;*/
            margin-top: 5px;
            margin-left: 5px;
            height: 13px;
            font:normal normal normal 13px/13px 'Microsoft YaHei';
        }

        .pre{
            border: 0px;
            padding: 0px;
            margin: 0px;
        }

        .red{
            color: #ff6a19;
        }

        table td,th{
            text-align: center;
        }



    </style>

    <div class="row">
        <div class="col-lg-12">
            <%--<div class="panel panel-default">--%>
                <%--<div class="panel-heading">--%>
                    <%--<span><i class="fa fa-calendar red"></i><strong>车辆调拨</strong></span>--%>
                <%--</div>--%>

                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12" style="margin:5px 0;">
                            <div class="col-md-1"></div>
                            <div class="col-md-9">
                                <div class="form-group" style="margin-top: 15px" id="filediv">
                                    <a href='javascript:void(0);' class="btn btn-outline btn-primary btn-sm aaa fa fa-file" >选择文件</a>
                                    <input type="file" id="fileId" class="myFileUpload" onchange = "getFile()" style="width:90px"/>
                                    <%--<a href='javascript:void(0);' class="btn-danger blueButton">选择文件</a>--%>
                                    <button type="button" class="btn btn-outline btn-primary btn-sm fa fa-pencil-square-o" style="margin-left:30px;width:90px" href="#inputModal" data-toggle="modal">手动输入</button>
                                    <button type="button" class="btn btn-outline btn-primary btn-sm" style="margin-left:30px;width:70px" onclick="allocate_batch_choose();" data-toggle="modal">批量调拨</button>
                                    <%--<button type="button" class="btn btn-outline btn-primary btn-sm" style="margin-left:30px;width:60px" onclick="" data-toggle="modal">换货</button>--%>
                                    <%--<button type="button" class="btn btn-outline btn-primary btn-sm" style="margin-left:30px;width:60px" onclick="" data-toggle="modal">退货</button>--%>
                                    <%--<button type="button" class="btn btn-outline btn-primary btn-sm" style="margin-left:30px;width:60px" onclick="" data-toggle="modal">重置</button>--%>
                                    <%--<button type="button" class="btn btn-outline btn-primary btn-sm" style="margin-left:80px;width:60px" onclick="upload()">读取</button>--%>
                                    <%--<button type="button" class="btn btn-primary btn-sm btn-danger blueInput" style="margin-left:110px;" onclick="upload()">读取</button>--%>
                                    <div class="show"></div>
                                </div>
                            </div>
                            <div class="col-md-2">
                                <div class="form-group">
                                    <%--<button type="button" class="btn btn-outline btn-primary btn-sm" style="width:60px" href="#allocate" data-toggle="modal">调拨</button>--%>
                                    <%--<button type="button" class="btn btn-primary btn-sm btn-danger blueInput" href="#allocate" data-toggle="modal">调拨</button>--%>
                                </div>
                            </div>
                        </div>

                        <div class="col-lg-12">
                            <div class="panel panel-default">
                                <div class="panel-heading" id="_title"><pre class="pre">车辆信息</pre></div>
                                <!-- /.panel-heading -->
                                <div class="panel-body">
                                    <div class="dataTable_wrapper">
                                        <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                            <thead>
                                            <tr>
                                                <th style="width:50%;">中控号</th>
                                                <th style="width:50%;">操作</th>
                                            </tr>
                                            </thead>
                                            <tbody id="tbody">
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                <!-- /.panel-body -->
                            </div>
                            <!-- /.panel -->
                        </div>
                        <!-- /.col-lg-12 -->
                    </div>
                </div>
            <%--</div>--%>
        </div>
    </div>
    <!--/row-->

    <style type="text/css">
        #allocate_body {
            width: 560px;
            height: auto;
        }
    </style>
    <div class="modal fade" id="allocateModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">车辆调拨</h4>
                    <input type="hidden" id="controllerIdInModal"/>
                </div>
                <div class="modal-body">
                    <div id="allocate_body">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="col-md-12 form-group">
                                    <span for="platformCode">厂商</span>
                                    <span>
                                        <select class="form-control" name='platformCode' id='platformCode'>
                                        </select>
                                    </span>
                                </div>
                            </div>

                            <div class="col-lg-12">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <span for="remark">备注描述</span>
                                        <span>
                                            <textarea class="form-control" name="remark" id="remark" rows="3"></textarea>
                                        </span>
                                    </div>
                                </div>
                            </div>

                            <div class="col-lg-12" style="display:none;">
                                <input type="text" value="${sessionScope.account.userName}" class="form-control " name="userName" id="userName"/>
                                <input type="text" value="${sessionScope.account.accountId}" class="form-control " name="accountId" id="accountId"/>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="modal-footer" style="margin-top:0px;">
                    <button type="button" class="btn btn-primary" id="allocate_sure_batch" onclick="allocate_batch_sure();" data-dismiss="modal">确定</button>
                    <button type="button" class="btn btn-primary" id="allocate_sure_one" onclick="allocate_one_sure();" data-dismiss="modal">确定</button>

                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->

    <!-- 手动输入modal -->
    <div class="modal fade" id="inputModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" onclick="closeModal();" aria-hidden="true">×</button>
                    <h4 class="modal-title">请输入要调拨的中控号</h4>
                </div>
                <div class="modal-body">
                    <div>
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <span for="remark">中控号(不区分大小写）</span>
                                        <span class="red"></span>
                                        <span>
                                            <input type="text" class="form-control" id="inputCId"></input>
                                        </span>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer" style="margin-top:0px;">
                    <button type="button" class="btn btn-primary" onclick="addCId();">确定</button>
                    <button type="button" class="btn btn-primary" onclick="closeModal();">取消</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>


    <script>
        $(function(){
            getGroup();
        })

        function upload() {
            //判断文件类型
            var filePath=$(".show").html();
            if(filePath.length==0){
                showalert(-1,"请选择文件");
                return;
            }
            if(filePath.indexOf("txt")==-1){
                showalert(-1,"只支持读取txt文件");
                return;
            }
            //判断文件是否为空
            var objFile = document.getElementById("fileId").files[0];
            if (objFile.value == "") {
                showalert(-1,"文件内容为空");
                return;
            }
            //console.log(objFile.files[0].size); // 文件字节数

            var files = $('#fileId').prop('files');//获取到文件列表
            if (files.length == 0) {
                showalert(-1,'请选择文件');
            } else {

                str_array = [];
                controller_id_array = [];
                var repeat_num = 0;
                var reader = new FileReader();//新建一个FileReader
                reader.readAsText(files[0], "UTF-8");//读取文件
                reader.onload = function (evt) { //读取完文件之后会回来这里
                    var fileString = evt.target.result; // 读取文件内容

                    //过滤空行
                    var reg = /\n(\n)*( )*(\n)*\n/g;
                    fileString = fileString.replace(reg,"\n");
                    str_array = fileString.split(/\r?\n/);

                    //过滤str_array中的空值
                    for(var i=0;i<str_array.length;i++){
                        var c = str_array[i];
                        if(c==null || c==""){
                            str_array.splice(i,1);
                        }
                    }

                    //将str_array中的重复中控号过滤
                    for(var i=0;i<str_array.length;i++){
                        if(str_array[i]!=null && str_array[i]!=""){
                            if($.inArray(str_array[i],controller_id_array)==-1){
                            controller_id_array.push(str_array[i]);
                            }
                        }
                    }
                    //将controller_id_array中与列表中重复的车辆过滤
                    list_array = [];
                    var flag = true;
                    $("input[name=controllerId]").each(function(i){
                        list_array.push($(this).val());
                    });
                    for(var i=0;i<controller_id_array.length;i++){
                        if($.inArray(controller_id_array[i],list_array)==-1){//不存在列表中

                        } else{//已经存在于列表中
                            controller_id_array.splice(i,1);
                            flag = false;
                        }
                    }

                    if(flag == false){
                        showalert(-1,"文件中部分中控号已存在列表中，已自动为您去重");
                    }

//                    //获取实际中控号个数
//                    var real_num = controller_id_array.length;
//                    //获取重复中控号个数
//                    repeat_num = str_array.length - controller_id_array.length;
//                    //计算文件中的中控号个数
//                    //var n = 0;
                    $.each(controller_id_array, function (i, value) {
                       // if(value!=null && value!=""){
                            $("#tbody").append('<tr class="odd gradeX">' +
                                '<td ><input type=hidden name="controllerId" value="'+value+'"/>' + value + '</td>' +
                                '<td><a class="fa fa-times" style="margin-right:20px;" href="javascript:void(0);" onclick="delete_one(this);">删除</a>' +
                                '<a class="fa fa-paper-plane" style="margin-right:20px;" href="javascript:void(0);" onclick="allocate_one_choose(this);">调拨</a>' +
//                                '<a class="fa fa-exchange" style="margin-right:20px;" href="javascript:void(0);" onclick="">换货</a>' +
//                                '<a class="fa fa-eraser" style="margin-right:20px;" href="javascript:void(0);" onclick="">退货</a>' +
//                                '<a class="fa fa-cog" style="margin-right:20px;" href="javascript:void(0);" onclick="">重置</a></td>' +
                                '</tr>').data("item", this);
                            //n += 1;
                        //}
                    });
//                    var total_num = str_array.length;

//                    $("#_title").html(
//                        "<pre class='pre'>文件中车辆信息("+ total_num +"辆)\t" +
//                        "重复车辆("+repeat_num+"辆)\t" +
//                        "实际车辆("+real_num+"辆)</pre>");
                }
            }
        }


        function getFile() {
            var arrs=$(".myFileUpload").val().split('\\');
            var filename=arrs[arrs.length-1];
            $(".show").html(filename);
            if(filename==null||filename==""){
                $("#_title").html("车辆信息");
                $("#tbody").empty();
            }else{
                upload();
                //重新生成input并替换原有input，解决打开同一文件不触发onchange事件问题
                $(".myFileUpload").replaceWith('<input type="file" id="fileId" class="myFileUpload" onchange = "getFile()"/>');
            }

        }

        function getGroup() {
            $.ajax({
                url: '${pageContext.request.contextPath}/v1/actors/groups/maps?type=0',
                type: 'GET',
                datatype: 'json',
                contentType: 'application/json;charset=utf-8',
                Accept: 'application/json',
                cache: false,
                success: function (data, textStatus, jqXHR) {
                    $("#platformCode").empty();
                    $(data.data).each(function () {
                        $("#platformCode").append('<option value="'+this.platformCode+'">'+this.groupName+'</option>').data("item", this);
                    });
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    return;
                }
            });
        }

        function allocate_batch_choose(){
            var CIds = '';
            $("input[name=controllerId]").each(function(i){
                if(0==i){
                    CIds = $(this).val();
                }else{
                    CIds += (","+$(this).val());
                }
            });
            if(CIds==undefined || CIds=="" || CIds==null){
                showalert(-1,"请选择文件或手动加入中控号")
                return;
            }
            $("#allocate_sure_batch").css("display","block");
            $("#allocate_sure_one").css("display","none");
            $("#allocateModal").modal("show");
        }

        function allocate_one_choose(obj){
            $("#allocate_sure_batch").css("display","none");
            $("#allocate_sure_one").css("display","block");
            $("#allocateModal").modal("show");
            var controllerId = $(obj).parent().prev().find("input[name=controllerId]").val();
            $("#controllerIdInModal").val(controllerId);
        }


        var allocate_batch_sure = function(){
            //获取controllers
            var CIds = '';
            $("input[name=controllerId]").each(function(i){
                if(0==i){
                    CIds = $(this).val();
                }else{
                    CIds += (","+$(this).val());
                }
            });

            if(CIds==undefined || CIds=="" || CIds==null){
                showalert(-1,"请选择文件或手动加入中控号")
                return;
            }
            showconfirm("确定调拨?",diaobo);
        }

        function allocate_one_sure(){
            var CId = $("#controllerIdInModal").val();
            if(CId==undefined || CId=="" || CId==null){
                showalert(-1,"请选择文件或手动加入中控号")
                return;
            }
            showconfirmwithargs("确定调拨?",allocate_one,CId);
        }

        function allocate_one(CId){
            var params = new Object();
            params.userName = $("#userName").val();
            params.accountId = $("#accountId").val();
            params.platformCode = $("#platformCode").val();
            params.remark = $("#remark").val();
            params.controllerIds = CId;
            $.ajax({
                url : '${pageContext.request.contextPath}/v1/machines/sn/allocate/bylist',
                type : 'POST',
                datatype : 'json',
                contentType : 'application/json;charset=utf-8',
                accept : 'application/json',
                data : JSON.stringify(params),
                cache : false,
                success: function (data, textStatus, jqXHR) {
                    var errorCode = data.errorCode;
                    var data2 = data.data;
                    if(errorCode == 0){
                        showalert(errorCode,data2);//直接输出data返回的信息
                        $("#_title").html("车辆信息");
                        $("#tbody").empty();
                        $(".show").empty();
                        //重新生成input并替换原有input，解决onchange事件只能触发一次的问题
                        $(".myFileUpload").replaceWith('<input type="file" id="fileId" class="myFileUpload" onchange = "getFile()"/>');
                    }else{
                        showalert(errorCode,data2);
                    }

                },
                error: function (jqXHR, textStatus, errorThrown) {
                    return;
                }
            });

        }

        //逐条向list中输入
        function addCId(){

            var value = $("#inputCId").val().toUpperCase();//转为字母大写

            if(value != null && value != undefined && value != ""){
                //检查是否有重复
                list_array = [];
                $("input[name=controllerId]").each(function(i){
                    list_array.push($(this).val());
                });
                for(var i=0;i<list_array.length;i++){
                    if($.inArray(value,list_array)==-1){//不重复

                    }else{
                        showalert(-1,"您输入的中控号已经存在于列表中，已为您去重");
                        return;
                    }
                }

                $("#tbody").append('<tr class="odd gradeX">' +
                    '<td ><input type=hidden name="controllerId" value="'+value+'"/>' + value + '</td>' +
                    '<td><a class="fa fa-times" style="margin-right:20px;" href="javascript:void(0);" onclick="delete_one(this);">删除</a>' +
                    '<a class="fa fa-paper-plane" style="margin-right:20px;" href="javascript:void(0);" onclick="allocate_one_choose(this);">调拨</a>' +
//                    '<a class="fa fa-exchange" style="margin-right:20px;" href="javascript:void(0);" onclick="">换货</a>' +
//                    '<a class="fa fa-eraser" style="margin-right:20px;" href="javascript:void(0);" onclick="">退货</a>' +
//                    '<a class="fa fa-cog" style="margin-right:20px;" href="javascript:void(0);" onclick="">重置</a></td>' +
                    '</tr>');
                $("#inputCId").parent().prev("span").text("");
                $("#inputModal").modal('hide');
                $("#inputCId").val("");
            }else{
                $("#inputCId").parent().prev("span").text("您还未输入中控号");
            }
        }
        //列表中删除某行
        function delete_one(obj){
            $(obj).parent().parent("tr").remove();
        }

        //关闭对话框
        function closeModal() {
            $("#inputCId").val("");
            $("#inputCId").parent().prev("span").text("");
            $("#inputModal").modal('hide');
        }

        //list调拨方法
        function diaobo() {
            //获取controllers
            var CIds = '';
            $("input[name=controllerId]").each(function(i){
                if(0==i){
                    CIds = $(this).val();
                }else{
                    CIds += (","+$(this).val());
                }
            });
//            console.log(CIds);
            if(CIds){
                var params = new Object();
                params.userName = $("#userName").val();
                params.accountId = $("#accountId").val();
                params.platformCode = $("#platformCode").val();
                params.remark = $("#remark").val();
                params.controllerIds = CIds;
                /////////
                $.ajax({
                    url : '${pageContext.request.contextPath}/v1/machines/sn/allocate/bylist',
                    type : 'POST',
                    datatype : 'json',
                    contentType : 'application/json;charset=utf-8',
                    accept : 'application/json',
                    data : JSON.stringify(params),
                    cache : false,
                    success: function (data, textStatus, jqXHR) {
                        var errorCode = data.errorCode;
                        var data2 = data.data;
                        if(errorCode == 0){
                            showalert(errorCode,data2);//直接输出data返回的信息
                            $("#_title").html("车辆信息");
                            $("#tbody").empty();
                            $(".show").empty();
                            //重新生成input并替换原有input，解决onchange事件只能触发一次的问题
                            $(".myFileUpload").replaceWith('<input type="file" id="fileId" class="myFileUpload" onchange = "getFile()"/>');
                        }else{
                            showalert(errorCode,data2);
                        }

                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        return;
                    }
                });

            }


        }
        //换货
        function exchangeGoods(){
            var CIds = '';
            $("input[name=controllerId]").each(function(i){
                if(0==i){
                    CIds = $(this).val();
                }else{
                    CIds += (","+$(this).val());
                }
            });
//            console.log(CIds);
            if(CIds) {
                var params = new Object();
                params.userName = $("#userName").val();
                params.accountId = $("#accountId").val();
                params.platformCode = $("#platformCode").val();
                params.remark = $("#remark").val();
                params.controllerIds = CIds;

                $.ajax({
                    url : '${pageContext.request.contextPath}/v1/machines/sn/allocate/exchange',
                    type: 'POST',
                    datatype: 'json',
                    contentType: 'application/json;charset=utf-8',
                    Accept: 'application/json',
                    cache: false,
                    success: function (data, textStatus, jqXHR) {

                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        return;
                    }
                });
            }




        }

        //退货
        function returnGoods(){
            //获取controllers
            var CIds = '';
            $("input[name=controllerId]").each(function(i){
                if(0==i){
                    CIds = $(this).val();
                }else{
                    CIds += (","+$(this).val());
                }
            });
//            console.log(CIds);
            if(CIds) {
                var params = new Object();
                params.userName = $("#userName").val();
                params.accountId = $("#accountId").val();
                params.platformCode = $("#platformCode").val();
                params.remark = $("#remark").val();
                params.controllerIds = CIds;

                $.ajax({
                    url : '${pageContext.request.contextPath}/v1/machines/sn/allocate/return',
                    type: 'POST',
                    datatype: 'json',
                    contentType: 'application/json;charset=utf-8',
                    Accept: 'application/json',
                    cache: false,
                    success: function (data, textStatus, jqXHR) {

                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        return;
                    }
                });
            }

        }





        <%--//文件调拨方法--%>
        <%--function diaobo(){--%>
            <%--var filePath=$(".show").html();--%>
            <%--var fileObj = document.getElementById("fileId").files[0]; // 获取文件对象--%>
            <%--if(fileObj){--%>
                <%--var FileController = '${pageContext.request.contextPath}/v1/machines/sn/allocate'; // 接收上传文件的后台地址--%>
                <%--var params = new Object();--%>
                <%--params.userName = $("#userName").val();--%>
                <%--params.accountId = $("#accountId").val();--%>
                <%--params.platformCode = $("#platformCode").val();--%>
                <%--params.remark = $("#remark").val();--%>

                <%--// FormData 对象--%>
                <%--var form = new FormData();--%>
                <%--form.append("file", fileObj);// 文件对象--%>
                <%--form.append("params", JSON.stringify(params));--%>

                <%--// XMLHttpRequest 对象--%>
                <%--var xhr = new XMLHttpRequest();--%>
                <%--xhr.open("post", FileController, true);--%>
                <%--xhr.onload = function () {--%>
                    <%--var responseStr = xhr.responseText;--%>
                    <%--if(!(responseStr.indexOf("errorCode")>-1)){--%>
                        <%--showalert(-1,"系统内部错误");--%>
                        <%--return;--%>
                    <%--}else{--%>
                        <%--var response = JSON.parse(responseStr);--%>
                        <%--var errorCode = response.errorCode;--%>
                        <%--var data = response.data;--%>
                        <%--showalert(errorCode,data);//直接输出data返回的信息--%>
                        <%--$("#_title").html("车辆信息");--%>
                        <%--$("#tbody").empty();--%>
                        <%--$(".show").empty();--%>
                        <%--//重新生成input并替换原有input，解决onchange事件只能触发一次的问题--%>
                        <%--$(".myFileUpload").replaceWith('<input type="file" id="fileId" class="myFileUpload" onchange = "getFile()"/>');--%>

                    <%--}--%>
                <%--};--%>
                <%--xhr.send(form);--%>

            <%--}else{--%>
                <%--showalert(-1,"未选择文件");--%>
            <%--}--%>
        <%--}--%>

//        function upload() {
//            //判断文件类型
//            var filePath=$(".show").html();
//            if(filePath.length==0){
//                showalert(-1,"请选择文件");
//                return;
//            }
//            if(filePath.indexOf("txt")==-1){
//                showalert(-1,"只支持读取txt文件");
//                return;
//            }
//            //判断文件是否为空
//            var objFile = document.getElementById("fileId").files[0];
//            if (objFile.value == "") {
//                showalert(-1,"文件内容为空");
//                return;
//            }
//            //console.log(objFile.files[0].size); // 文件字节数
//
//            var files = $('#fileId').prop('files');//获取到文件列表
//            if (files.length == 0) {
//                showalert(-1,'请选择文件');
//            } else {
//
//                str_array = [];
//                controller_id_array = [];
//                var repeat_num = 0;
//                var reader = new FileReader();//新建一个FileReader
//                reader.readAsText(files[0], "UTF-8");//读取文件
//                reader.onload = function (evt) { //读取完文件之后会回来这里
//                    var fileString = evt.target.result; // 读取文件内容
//
//                    //过滤空行
//                    var reg = /\n(\n)*( )*(\n)*\n/g;
//                    fileString = fileString.replace(reg,"\n");
//                    str_array = fileString.split(/\r?\n/);
//
//                    //过滤str_array中的空值
//                    for(var i=0;i<str_array.length;i++){
//                        var c = str_array[i];
//                        if(c==null || c==""){
//                            str_array.splice(i,1);
//                        }
//                    }
//
//                    //将str_array中的重复中控号过滤
//                    for(var i=0;i<str_array.length;i++){
//                        if(str_array[i]!=null && str_array[i]!=""){
//                            if($.inArray(str_array[i],controller_id_array)==-1){
//                                controller_id_array.push(str_array[i]);
//                            }
//                        }
//                    }
//
//                    //获取实际中控号个数
//                    var real_num = controller_id_array.length;
//                    //获取重复中控号个数
//                    repeat_num = str_array.length - controller_id_array.length;
//                    //计算文件中的中控号个数
//                    //var n = 0;
//                    $.each(controller_id_array, function (i, value) {
//                        // if(value!=null && value!=""){
//                        $("#tbody").append('<tr class="odd gradeX">' +
//                            '<td ><input type=hidden name="controllerId" value="'+value+'"/>' + value + '</td>' +
//                            '<td><a class="fa fa-times" style="margin-right:20px;" href="javascript:void(0);" onclick="delete_one(this);">删除</a>' +
//                            '<a class="fa fa-paper-plane" style="margin-right:20px;" href="javascript:void(0);" onclick="allocate_one_choose(this);">调拨</a>' +
////                                '<a class="fa fa-exchange" style="margin-right:20px;" href="javascript:void(0);" onclick="">换货</a>' +
////                                '<a class="fa fa-eraser" style="margin-right:20px;" href="javascript:void(0);" onclick="">退货</a>' +
////                                '<a class="fa fa-cog" style="margin-right:20px;" href="javascript:void(0);" onclick="">重置</a></td>' +
//                            '</tr>').data("item", this);
//                        //n += 1;
//                        //}
//                    });
//                    var total_num = str_array.length;
//
//                    $("#_title").html(
//                        "<pre class='pre'>车辆信息("+ total_num +"辆)\t" +
//                        "重复车辆("+repeat_num+"辆)\t" +
//                        "实际车辆("+real_num+"辆)</pre>");
//                }
//            }
//        }



        <%--}--%>
    </script>
    <%@include file="../alert.jsp"%>
</page:page>
